<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   基于R语言的ggplot2的大数定律和中心极限定理验证  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://dataunion.org/16951.html",
                  host: "http://dataunion.org",
                  prePath: "http://dataunion.org",
                  scheme: "http",
                  pathBase: "http://dataunion.org/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466454852: Accept with keywords: (title(0.166666666667):社区,中心,定律,大数,数盟,R语言, topn(0.533333333333):社区,均值,中心,方差,职业规划,数盟,标准,分布,数据挖掘,点数,图形,卡方分布,结果,定律,样本均值,可视化,文章,基础架构,图层,绘制,正态分布,大数,样本,样本量,统计图,行业资讯,数据,正态,曲线,密度).-->
 </head>
 <body onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    基于R语言的ggplot2的大数定律和中心极限定理验证
   </h1>
  </div>
  <div class="container" id="xmain">
   ﻿﻿
   <title>
    基于R语言的ggplot2的大数定律和中心极限定理验证 | 数盟社区
   </title>
   <!-- All in One SEO Pack 2.2.7.6.2 by Michael Torbert of Semper Fi Web Design[32,74] -->
   <!-- /all in one seo pack -->
   <!--
<div align="center">
<a href="http://strata.oreilly.com.cn/hadoop-big-data-cn?cmp=mp-data-confreg-home-stcn16_dataunion_pc" target="_blank"><img src="http://dataunion.org/wp-content/uploads/2016/05/stratabj.jpg"/ ></a>
</div>
-->
   <header id="header-web">
    <div class="header-main">
     <hgroup class="logo">
      <h1>
       <a href="http://dataunion.org/" rel="home" title="数盟社区">
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/logo.png"/>
       </a>
      </h1>
     </hgroup>
     <!--logo-->
     <nav class="header-nav">
      <ul class="menu" id="menu-%e4%b8%bb%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-71" id="menu-item-71">
        <a href="http://dataunion.org/category/events" title="events">
         活动
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22457" id="menu-item-22457">
          <a href="http://dataunion.org/2016timeline">
           2016档期
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22459" id="menu-item-22459">
          <a href="http://dataunion.org/category/parterc">
           合作会议
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-has-children menu-item-20869" id="menu-item-20869">
        <a href="http://dataunion.org/category/tech" title="articles">
         文章
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20867" id="menu-item-20867">
          <a href="http://dataunion.org/category/tech/base" title="base">
           基础架构
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3302" id="menu-item-3302">
          <a href="http://dataunion.org/category/tech/ai" title="ai">
           人工智能
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3303" id="menu-item-3303">
          <a href="http://dataunion.org/category/tech/analysis" title="analysis">
           数据分析
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21920" id="menu-item-21920">
          <a href="http://dataunion.org/category/tech/dm">
           数据挖掘
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3314" id="menu-item-3314">
          <a href="http://dataunion.org/category/tech/viz" title="viz">
           可视化
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3305" id="menu-item-3305">
          <a href="http://dataunion.org/category/tech/devl" title="devl">
           编程语言
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-20876" id="menu-item-20876">
        <a href="http://dataunion.org/category/industry">
         行业
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-16328" id="menu-item-16328">
          <a href="http://dataunion.org/category/industry/case" title="case">
           行业应用
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-2112" id="menu-item-2112">
          <a href="http://dataunion.org/category/industry/demo" title="demo">
           Demo展示
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21562" id="menu-item-21562">
          <a href="http://dataunion.org/category/industry/news">
           行业资讯
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-311" id="menu-item-311">
        <a href="http://dataunion.org/category/sources" title="sources">
         资源
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20870" id="menu-item-20870">
        <a href="http://dataunion.org/category/books" title="book">
         图书
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21363" id="menu-item-21363">
        <a href="http://dataunion.org/category/training">
         课程
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-21853" id="menu-item-21853">
        <a href="http://dataunion.org/category/jobs">
         职位
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22050" id="menu-item-22050">
          <a href="http://dataunion.org/category/career">
           职业规划
          </a>
         </li>
        </ul>
       </li>
      </ul>
     </nav>
     <!--header-nav-->
    </div>
   </header>
   <!--header-web-->
   <div id="main">
    <div id="soutab">
     <form action="http://dataunion.org/" class="search" method="get">
     </form>
    </div>
    <div id="container">
     <nav id="mbx">
      当前位置：
      <a href="http://dataunion.org">
       首页
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech">
       文章
      </a>
      &gt;  正文
     </nav>
     <!--mbx-->
     <article class="content">
      <header align="centre" class="contenttitle">
       <div class="mscc">
        <h1 class="mscctitle">
         <a href="http://dataunion.org/16951.html">
          基于R语言的ggplot2的大数定律和中心极限定理验证
         </a>
        </h1>
        <address class="msccaddress ">
         <em>
          3,718 次阅读 -
         </em>
         <a href="http://dataunion.org/category/tech" rel="category tag">
          文章
         </a>
        </address>
       </div>
      </header>
      <div class="content-text">
       <p>
        大数定律（Law of Large Numbers，LLN）和中心极限定理（Central Limit Theory，CLT）是概率论中的重要基石，但也是经常被忽略的一个部分。通常学习一门概率论课会介绍很多章节的基础内容，才会在最后几张学习到 LLN 和 CLT，而这个时候因为期末和赶课时容易草草结课。理解这两个定律对理解随机现象的统计规律和为什么正态分布的应用如此广泛至关重要。
       </p>
       <p>
        在这篇文章中，我会试着介绍大数定律和中心极限定理，以便在直觉上更加容易理解。因为最近正接触
        <a class=" wrap external" href="http://ggplot2.org/" rel="nofollow noreferrer" target="_blank">
         ggplot2
         <i class="icon-external">
         </i>
        </a>
        ，我主要会用 ggplot2 给出样本量变化时各分布相关统计量的变化结果。
       </p>
       <h2>
        ggplot2
       </h2>
       <p>
        ggplot2 是一个绘制数据图形的 R 软件包。它 的基础是一套描述所有统计图形深层特性的语法规则，这套语法告诉我们，一张统计图形就是从数据到
        <b>
         几何对象
        </b>
        的
        <b>
         图形属性
        </b>
        的一个映射，这让它与现有的很多图形软件区别开来，不再是一系列特例的堆砌。ggplot2可以绘制出很多美观的图形，同时避免诸多繁琐的细节。采用图层的设计方式，你可以从原始的图层开始，首先绘制原始数据，然后不断得添加图形注释和统计汇总结果。这种绘图方式与分析问题中的结构化思维是一致的，缩短了“所思”与“所见”的距离。总的来说，ggplot2 是一款非常 human-friendly 的 R package。
       </p>
       <h2>
        大数定律
       </h2>
       <p>
        对频率学派而言，大数定律回答了“为何能以某事件发生的频率作为该事件发生概率的估计”的问题。
       </p>
       <p>
        <a href="http://dataunion.org/wp-content/uploads/2015/05/QQ截图20150512195130.png">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/QQ截图20150512195130.png"/>
        </a>
       </p>
       <blockquote>
        <p>
         <i>
          大数定律以严格的数学形式表现了随机现象最根本的性质之一：平均结果的稳定性。
         </i>
        </p>
       </blockquote>
       <p>
        为了验证大数定律，我任选了
        <a class=" wrap external" href="http://baike.baidu.com/view/1419652.htm?fr=aladdin" rel="nofollow noreferrer" target="_blank">
         t 分布
         <i class="icon-external">
         </i>
        </a>
        和
        <a class=" wrap external" href="http://baike.baidu.com/view/859454.htm?fr=aladdin" rel="nofollow noreferrer" target="_blank">
         卡方分布
         <i class="icon-external">
         </i>
        </a>
        作为试验对象，用计算机模拟试验，并用 ggplot2 绘制出结果，所有的操作均在
        <a class=" wrap external" href="http://www.baidu.com/link?url=N2gOJFj_9yegAcMUMe7l4BZYgQJ7s31D7hVcXeusljj8sLc0XDfXrQkwWWkEbj1J" rel="nofollow noreferrer" target="_blank">
         Rstudio
         <i class="icon-external">
         </i>
        </a>
        上完成。
       </p>
       <div class="highlight">
        <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
        <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576853407329c974512305" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
         <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <span class="crayon-title">
          </span>
          <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-wrap-button" title="切换自动换行">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-expand-button" title="点击展开代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-copy-button" title="复制代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
          </div>
         </div>
         <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
         </div>
         <div class="crayon-plain-wrap">
          <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
           &lt;span class="go"&gt;#自由度为3的卡方分布&lt;/span&gt;
&lt;span class="go"&gt;a &amp;lt;- rchisq(10000,3)  &lt;/span&gt;
&lt;span class="go"&gt;largenumber_experiment &amp;lt;- function(n,a){&lt;/span&gt;
&lt;span class="go"&gt;  y &amp;lt;- rep(0,n)&lt;/span&gt;
&lt;span class="go"&gt;  for (i in 1:n){&lt;/span&gt;
&lt;span class="go"&gt;    y[i] &amp;lt;- mean(sample(a,i,replace=TRUE))&lt;/span&gt;
&lt;span class="go"&gt;  }&lt;/span&gt;
&lt;span class="go"&gt;  data &amp;lt;- data.frame(1:n,y)&lt;/span&gt;
&lt;span class="go"&gt;  list(data=data)&lt;/span&gt;
&lt;span class="go"&gt;}  &lt;/span&gt;
&lt;span class="go"&gt;object &amp;lt;- largenumber_experiment(n=10000,a)&lt;/span&gt;
&lt;span class="go"&gt;lln_data &amp;lt;- object$data&lt;/span&gt;
&lt;span class="go"&gt;colnames(llt_data) &amp;lt;- c("sample_size","average_value")&lt;/span&gt;

&lt;span class="go"&gt;library(ggplot2)&lt;/span&gt;
&lt;span class="go"&gt;ggplot(lln_data,aes(x=sample_size,y=average_value,color="path")) +&lt;/span&gt;
 
&lt;span class="go"&gt;labs(title="样本均值变化趋势")&lt;/span&gt;
&lt;span class="go"&gt; + geom_line() + geom_abline(intercept=3,slope=0,color='grey')&lt;/span&gt;
          </textarea>
         </div>
         <div class="crayon-main" style="">
          <table class="crayon-table">
           <tbody>
            <tr class="crayon-row">
             <td class="crayon-nums " data-settings="show">
              <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
               <div class="crayon-num" data-line="crayon-576853407329c974512305-1">
                1
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576853407329c974512305-2">
                2
               </div>
               <div class="crayon-num" data-line="crayon-576853407329c974512305-3">
                3
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576853407329c974512305-4">
                4
               </div>
               <div class="crayon-num" data-line="crayon-576853407329c974512305-5">
                5
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576853407329c974512305-6">
                6
               </div>
               <div class="crayon-num" data-line="crayon-576853407329c974512305-7">
                7
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576853407329c974512305-8">
                8
               </div>
               <div class="crayon-num" data-line="crayon-576853407329c974512305-9">
                9
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576853407329c974512305-10">
                10
               </div>
               <div class="crayon-num" data-line="crayon-576853407329c974512305-11">
                11
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576853407329c974512305-12">
                12
               </div>
               <div class="crayon-num" data-line="crayon-576853407329c974512305-13">
                13
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576853407329c974512305-14">
                14
               </div>
               <div class="crayon-num" data-line="crayon-576853407329c974512305-15">
                15
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576853407329c974512305-16">
                16
               </div>
               <div class="crayon-num" data-line="crayon-576853407329c974512305-17">
                17
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576853407329c974512305-18">
                18
               </div>
               <div class="crayon-num" data-line="crayon-576853407329c974512305-19">
                19
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-576853407329c974512305-20">
                20
               </div>
              </div>
             </td>
             <td class="crayon-code">
              <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
               <div class="crayon-line" id="crayon-576853407329c974512305-1">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-p">
                 #自由度为3的卡方分布&lt;/span&gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576853407329c974512305-2">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-v">
                 a
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 rchisq
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 10000
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-cn">
                 3
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576853407329c974512305-3">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-v">
                 largenumber_experiment
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 function
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 n
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 a
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 {
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576853407329c974512305-4">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 y
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 rep
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 0
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 n
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576853407329c974512305-5">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 for
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-i">
                 i
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 in
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-cn">
                 1
                </span>
                <span class="crayon-o">
                 :
                </span>
                <span class="crayon-v">
                 n
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 {
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576853407329c974512305-6">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 y
                </span>
                <span class="crayon-sy">
                 [
                </span>
                <span class="crayon-v">
                 i
                </span>
                <span class="crayon-sy">
                 ]
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 mean
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-e">
                 sample
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 a
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 i
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 replace
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-t">
                 TRUE
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576853407329c974512305-7">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 }
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576853407329c974512305-8">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 data
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 data
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 frame
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 1
                </span>
                <span class="crayon-o">
                 :
                </span>
                <span class="crayon-v">
                 n
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 y
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576853407329c974512305-9">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 list
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 data
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-v">
                 data
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576853407329c974512305-10">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-sy">
                 }
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576853407329c974512305-11">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-t">
                 object
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 largenumber_experiment
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 n
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-cn">
                 10000
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 a
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576853407329c974512305-12">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-v">
                 lln_data
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-t">
                 object
                </span>
                <span class="crayon-sy">
                 $
                </span>
                <span class="crayon-v">
                 data
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576853407329c974512305-13">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-e">
                 colnames
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 llt_data
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 c
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-s">
                 "sample_size"
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-s">
                 "average_value"
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576853407329c974512305-14">
               </div>
               <div class="crayon-line" id="crayon-576853407329c974512305-15">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-e">
                 library
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 ggplot2
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576853407329c974512305-16">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-e">
                 ggplot
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 lln_data
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-e">
                 aes
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 x
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-v">
                 sample_size
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 y
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-v">
                 average_value
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 color
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "path"
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576853407329c974512305-17">
                <span class="crayon-h">
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576853407329c974512305-18">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-e">
                 labs
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 title
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "样本均值变化趋势"
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-576853407329c974512305-19">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 geom_line
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 geom_abline
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 intercept
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-cn">
                 3
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 slope
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-cn">
                 0
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 color
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 'grey'
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-576853407329c974512305-20">
               </div>
              </div>
             </td>
            </tr>
           </tbody>
          </table>
         </div>
        </div>
        <!-- [Format Time: 0.0424 seconds] -->
       </div>
       <p>
        <img src="http://dataunion.org/wp-content/uploads/2015/05/8d8c16eacc31f357eb9d45853127ef93_b1.jpg"/>
       </p>
       <p>
        自由度为 5 的 t 分布：
       </p>
       <p>
        <img src="http://dataunion.org/wp-content/uploads/2015/05/6b744f1777544036037b1c3c6efd002f_b1.jpg"/>
       </p>
       <p>
        上面的两张图里可以看到，小样本情况下，样本均值非常不稳定，但随着样本量的增大到10000时，样本均值的收敛性已经比较明显，基本收敛于总体均值（分别为3 和 0，见灰色水平线）。
       </p>
       <h2>
        中心极限定理
       </h2>
       <p>
        已经知道了样本均值的收敛性质，下一步我们还想知道的是，当样本量充分大的时候，样本均值的分布又是什么？CLT 给出了答案：
       </p>
       <p>
        前提假设同上，总体方差为。则
       </p>
       <p>
        时
       </p>
       <p>
        这个定理更神奇的地方在于：即使样本原分布不是正态分布，随着样本量增大，样本均值的分布会越来越接近正态分布。这就解释了自然界中为什么许多现象都可认为近似服从正态。比如高斯曾证明了测量误差服从正态，所以正态分布也可叫作高斯分布。
       </p>
       <p>
        同样用一个例子给出直观的解释，假设我们抛一个六面体骰子很多次。第一次投掷后，我们期待所有面出现的概率都是 1/6。然后掷第二次，显然两次点数之和为2和12的概率要小于其它可能。期望的投掷结果为：
       </p>
       <p>
        <img src="http://dataunion.org/wp-content/uploads/2015/05/47de7eb84aff5c41e0f7aa41308877a2_b1.jpg"/>
       </p>
       <p>
        次数逐次增加，这次连掷三次，期望的点数和概率分布：
       </p>
       <p>
        <img src="http://dataunion.org/wp-content/uploads/2015/05/144316ecc1ca945e412139ce79bb9e18_b1.jpg"/>
       </p>
       <p>
        这张图的形状已经有点像正态了，随着投掷次数趋向无穷，点数和的概率分布将趋近于正态。投掷的点数和不太会很小，也不太会很大，“中心极限”的定义变得十分形象。
       </p>
       <p>
        接下来我依旧用 ggplot2 作图：
       </p>
       <div class="highlight">
        <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
        <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57685340732af318272085" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
         <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <span class="crayon-title">
          </span>
          <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-wrap-button" title="切换自动换行">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-expand-button" title="点击展开代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-copy-button" title="复制代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
          </div>
         </div>
         <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
         </div>
         <div class="crayon-plain-wrap">
          <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
           &lt;span class="go"&gt;#自由度为10的卡方分布，均值10，方差20&lt;/span&gt;
&lt;span class="go"&gt;a &amp;lt;- rchisq(n=10000,df=10) &lt;/span&gt;

&lt;span class="go"&gt;y &amp;lt;- rep(0,100);z&amp;lt;- rep(0,100)&lt;/span&gt;
&lt;span class="go"&gt;for(i in 1:100){&lt;/span&gt;
&lt;span class="go"&gt;   y[i] &amp;lt;- mean(sample(a,10,replace=TRUE))&lt;/span&gt;
&lt;span class="go"&gt;   z[i] &amp;lt;- (y[i]-10)*sqrt(10)/sqrt(20)&lt;/span&gt;
&lt;span class="go"&gt;}&lt;/span&gt;
&lt;span class="go"&gt;p&amp;lt;- rep(0,100)&lt;/span&gt;
&lt;span class="go"&gt;for(i in 1:100){&lt;/span&gt;
&lt;span class="go"&gt;  y[i] &amp;lt;- mean(sample(a,1000,replace=TRUE))&lt;/span&gt;
&lt;span class="go"&gt;  p[i] &amp;lt;- (y[i]-10)*sqrt(1000)/sqrt(20)&lt;/span&gt;
&lt;span class="go"&gt;}&lt;/span&gt;

&lt;span class="go"&gt;q &amp;lt;- rep(0,100)&lt;/span&gt;
&lt;span class="go"&gt;for(i in 1:100){&lt;/span&gt;
&lt;span class="go"&gt;  y[i] &amp;lt;- mean(sample(a,100,replace=TRUE))&lt;/span&gt;
&lt;span class="go"&gt;  q[i] &amp;lt;- (y[i]-10)*sqrt(100)/sqrt(20)&lt;/span&gt;
&lt;span class="go"&gt;}&lt;/span&gt;

&lt;span class="go"&gt;clt_data &amp;lt;- data.frame(c(z,p),as.factor(c(rep(10,100),rep(1000,100))))&lt;/span&gt;
&lt;span class="go"&gt;colnames(clt_data) = c("value","sizelevel"）&lt;/span&gt;

&lt;span class="go"&gt;ggplot(data=clt_data,aes(x=value)) + labs(title="样本大小 vs ") + geom_histogram(aes(color=sizelevel,fill=sizelevel)) +&lt;/span&gt;
&lt;span class="go"&gt;facet_wrap(~sizelevel)&lt;/span&gt;
          </textarea>
         </div>
         <div class="crayon-main" style="">
          <table class="crayon-table">
           <tbody>
            <tr class="crayon-row">
             <td class="crayon-nums " data-settings="show">
              <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
               <div class="crayon-num" data-line="crayon-57685340732af318272085-1">
                1
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732af318272085-2">
                2
               </div>
               <div class="crayon-num" data-line="crayon-57685340732af318272085-3">
                3
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732af318272085-4">
                4
               </div>
               <div class="crayon-num" data-line="crayon-57685340732af318272085-5">
                5
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732af318272085-6">
                6
               </div>
               <div class="crayon-num" data-line="crayon-57685340732af318272085-7">
                7
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732af318272085-8">
                8
               </div>
               <div class="crayon-num" data-line="crayon-57685340732af318272085-9">
                9
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732af318272085-10">
                10
               </div>
               <div class="crayon-num" data-line="crayon-57685340732af318272085-11">
                11
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732af318272085-12">
                12
               </div>
               <div class="crayon-num" data-line="crayon-57685340732af318272085-13">
                13
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732af318272085-14">
                14
               </div>
               <div class="crayon-num" data-line="crayon-57685340732af318272085-15">
                15
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732af318272085-16">
                16
               </div>
               <div class="crayon-num" data-line="crayon-57685340732af318272085-17">
                17
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732af318272085-18">
                18
               </div>
               <div class="crayon-num" data-line="crayon-57685340732af318272085-19">
                19
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732af318272085-20">
                20
               </div>
               <div class="crayon-num" data-line="crayon-57685340732af318272085-21">
                21
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732af318272085-22">
                22
               </div>
               <div class="crayon-num" data-line="crayon-57685340732af318272085-23">
                23
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732af318272085-24">
                24
               </div>
               <div class="crayon-num" data-line="crayon-57685340732af318272085-25">
                25
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732af318272085-26">
                26
               </div>
              </div>
             </td>
             <td class="crayon-code">
              <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
               <div class="crayon-line" id="crayon-57685340732af318272085-1">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-p">
                 #自由度为10的卡方分布，均值10，方差20&lt;/span&gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732af318272085-2">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-v">
                 a
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 rchisq
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 n
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-cn">
                 10000
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 df
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-cn">
                 10
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-57685340732af318272085-3">
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732af318272085-4">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-v">
                 y
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 rep
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 0
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-cn">
                 100
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-v">
                 z
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 rep
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 0
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-cn">
                 100
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-57685340732af318272085-5">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-st">
                 for
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-i">
                 i
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 in
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-cn">
                 1
                </span>
                <span class="crayon-o">
                 :
                </span>
                <span class="crayon-cn">
                 100
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 {
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732af318272085-6">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 y
                </span>
                <span class="crayon-sy">
                 [
                </span>
                <span class="crayon-v">
                 i
                </span>
                <span class="crayon-sy">
                 ]
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 mean
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-e">
                 sample
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 a
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-cn">
                 10
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 replace
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-t">
                 TRUE
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-57685340732af318272085-7">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 z
                </span>
                <span class="crayon-sy">
                 [
                </span>
                <span class="crayon-v">
                 i
                </span>
                <span class="crayon-sy">
                 ]
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 y
                </span>
                <span class="crayon-sy">
                 [
                </span>
                <span class="crayon-v">
                 i
                </span>
                <span class="crayon-sy">
                 ]
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-cn">
                 10
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 *
                </span>
                <span class="crayon-e">
                 sqrt
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 10
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-e">
                 sqrt
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 20
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732af318272085-8">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-sy">
                 }
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-57685340732af318272085-9">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-v">
                 p
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 rep
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 0
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-cn">
                 100
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732af318272085-10">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-st">
                 for
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-i">
                 i
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 in
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-cn">
                 1
                </span>
                <span class="crayon-o">
                 :
                </span>
                <span class="crayon-cn">
                 100
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 {
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-57685340732af318272085-11">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 y
                </span>
                <span class="crayon-sy">
                 [
                </span>
                <span class="crayon-v">
                 i
                </span>
                <span class="crayon-sy">
                 ]
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 mean
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-e">
                 sample
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 a
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-cn">
                 1000
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 replace
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-t">
                 TRUE
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732af318272085-12">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 p
                </span>
                <span class="crayon-sy">
                 [
                </span>
                <span class="crayon-v">
                 i
                </span>
                <span class="crayon-sy">
                 ]
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 y
                </span>
                <span class="crayon-sy">
                 [
                </span>
                <span class="crayon-v">
                 i
                </span>
                <span class="crayon-sy">
                 ]
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-cn">
                 10
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 *
                </span>
                <span class="crayon-e">
                 sqrt
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 1000
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-e">
                 sqrt
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 20
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-57685340732af318272085-13">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-sy">
                 }
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732af318272085-14">
               </div>
               <div class="crayon-line" id="crayon-57685340732af318272085-15">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-v">
                 q
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 rep
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 0
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-cn">
                 100
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732af318272085-16">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-st">
                 for
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-i">
                 i
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-st">
                 in
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-cn">
                 1
                </span>
                <span class="crayon-o">
                 :
                </span>
                <span class="crayon-cn">
                 100
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 {
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-57685340732af318272085-17">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 y
                </span>
                <span class="crayon-sy">
                 [
                </span>
                <span class="crayon-v">
                 i
                </span>
                <span class="crayon-sy">
                 ]
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 mean
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-e">
                 sample
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 a
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-cn">
                 100
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 replace
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-t">
                 TRUE
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732af318272085-18">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 q
                </span>
                <span class="crayon-sy">
                 [
                </span>
                <span class="crayon-v">
                 i
                </span>
                <span class="crayon-sy">
                 ]
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 y
                </span>
                <span class="crayon-sy">
                 [
                </span>
                <span class="crayon-v">
                 i
                </span>
                <span class="crayon-sy">
                 ]
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-cn">
                 10
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 *
                </span>
                <span class="crayon-e">
                 sqrt
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 100
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-e">
                 sqrt
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 20
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-57685340732af318272085-19">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-sy">
                 }
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732af318272085-20">
               </div>
               <div class="crayon-line" id="crayon-57685340732af318272085-21">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-v">
                 clt_data
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 data
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 frame
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-e">
                 c
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 z
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 p
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-st">
                 as
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 factor
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-e">
                 c
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-e">
                 rep
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 10
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-cn">
                 100
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-e">
                 rep
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 1000
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-cn">
                 100
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732af318272085-22">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-e">
                 colnames
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 clt_data
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 c
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-s">
                 "value"
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-s">
                 "sizelevel"
                </span>
                ）
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-57685340732af318272085-23">
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732af318272085-24">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-e">
                 ggplot
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 data
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-v">
                 clt_data
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-e">
                 aes
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 x
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-v">
                 value
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 labs
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 title
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "样本大小 vs "
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 geom_histogram
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-e">
                 aes
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 color
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-v">
                 sizelevel
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 fill
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-v">
                 sizelevel
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-57685340732af318272085-25">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-e">
                 facet_wrap
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-o">
                 ~
                </span>
                <span class="crayon-v">
                 sizelevel
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732af318272085-26">
               </div>
              </div>
             </td>
            </tr>
           </tbody>
          </table>
         </div>
        </div>
        <!-- [Format Time: 0.0574 seconds] -->
       </div>
       <p>
        <img src="http://dataunion.org/wp-content/uploads/2015/05/f25361008555f4b50430301f6f52607a_b1.jpg"/>
        <img src="http://dataunion.org/wp-content/uploads/2015/05/c03bfbe1efbb3d6b8a7ce3241bfd1896_b1.jpg"/>
       </p>
       <p>
        上两图给出了样本不同情况下 ，记为 统计量 的直方图，和理论上符合的标准正态分布可作一下比较。
       </p>
       <div class="highlight">
        <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
        <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57685340732b9707756341" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
         <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <span class="crayon-title">
          </span>
          <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-wrap-button" title="切换自动换行">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-expand-button" title="点击展开代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-copy-button" title="复制代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
          </div>
         </div>
         <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
         </div>
         <div class="crayon-plain-wrap">
          <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
           &lt;span class="go"&gt;clt_data &amp;lt;- data.frame(c(z,p,q),as.factor(c(rep(10,100),rep(1000,100),rep(100,100))))&lt;/span&gt;
&lt;span class="go"&gt;colnames(clt_data) = c("value","sizelevel")&lt;/span&gt;

&lt;span class="go"&gt;qplot(value,data=clt_data,geom="density",color=sizelevel,size=I(1)) + &lt;/span&gt;
&lt;span class="go"&gt;geom_density(aes(x=rnorm(100,0,1),color="标准正态"),size=I(0.8),alpha=I(0.005)) +&lt;/span&gt;
&lt;span class="go"&gt;labs(title="各样本密度曲线") + xlab("value") &lt;/span&gt;
          </textarea>
         </div>
         <div class="crayon-main" style="">
          <table class="crayon-table">
           <tbody>
            <tr class="crayon-row">
             <td class="crayon-nums " data-settings="show">
              <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
               <div class="crayon-num" data-line="crayon-57685340732b9707756341-1">
                1
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732b9707756341-2">
                2
               </div>
               <div class="crayon-num" data-line="crayon-57685340732b9707756341-3">
                3
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732b9707756341-4">
                4
               </div>
               <div class="crayon-num" data-line="crayon-57685340732b9707756341-5">
                5
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732b9707756341-6">
                6
               </div>
               <div class="crayon-num" data-line="crayon-57685340732b9707756341-7">
                7
               </div>
              </div>
             </td>
             <td class="crayon-code">
              <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
               <div class="crayon-line" id="crayon-57685340732b9707756341-1">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-v">
                 clt_data
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &amp;
                </span>
                <span class="crayon-v">
                 lt
                </span>
                <span class="crayon-sy">
                 ;
                </span>
                <span class="crayon-o">
                 -
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-v">
                 data
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 frame
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-e">
                 c
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 z
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 p
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 q
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-st">
                 as
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-e">
                 factor
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-e">
                 c
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-e">
                 rep
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 10
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-cn">
                 100
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-e">
                 rep
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 1000
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-cn">
                 100
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-e">
                 rep
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 100
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-cn">
                 100
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732b9707756341-2">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-e">
                 colnames
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 clt_data
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 c
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-s">
                 "value"
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-s">
                 "sizelevel"
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-57685340732b9707756341-3">
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732b9707756341-4">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-e">
                 qplot
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 value
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 data
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-v">
                 clt_data
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 geom
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "density"
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 color
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-v">
                 sizelevel
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 size
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-e">
                 I
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 1
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-57685340732b9707756341-5">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-e">
                 geom_density
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-e">
                 aes
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 x
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-e">
                 rnorm
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 100
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-cn">
                 0
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-cn">
                 1
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 color
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "标准正态"
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 size
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-e">
                 I
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 0.8
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 alpha
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-e">
                 I
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 0.005
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732b9707756341-6">
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-e">
                 span
                </span>
                <span class="crayon-t">
                 class
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "go"
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
                <span class="crayon-e">
                 labs
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 title
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "各样本密度曲线"
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 xlab
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-s">
                 "value"
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 &lt;
                </span>
                <span class="crayon-o">
                 /
                </span>
                <span class="crayon-v">
                 span
                </span>
                <span class="crayon-o">
                 &gt;
                </span>
               </div>
               <div class="crayon-line" id="crayon-57685340732b9707756341-7">
               </div>
              </div>
             </td>
            </tr>
           </tbody>
          </table>
         </div>
        </div>
        <!-- [Format Time: 0.0296 seconds] -->
       </div>
       <p>
        <img src="http://dataunion.org/wp-content/uploads/2015/05/9df9587bb386de41ad17f04a0d92beca_b1.jpg"/>
       </p>
       <p>
        样本量最大为1000时和标准正态的密度曲线拟合的最好。
       </p>
       <div class="highlight">
        <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
        <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57685340732c0754466455" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
         <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <span class="crayon-title">
          </span>
          <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
           <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-wrap-button" title="切换自动换行">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-expand-button" title="点击展开代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-copy-button" title="复制代码">
            <div class="crayon-button-icon">
            </div>
           </div>
           <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
            <div class="crayon-button-icon">
            </div>
           </div>
          </div>
         </div>
         <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
         </div>
         <div class="crayon-plain-wrap">
          <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
           #分面
qplot(value,data=clt_data,geom="density",color=sizelevel,size=I(1),,facets=sizelevel~.) + 
geom_density(aes(x=rnorm(100,0,1),color="标准正态"),size=I(0.8),alpha=I(0.005)) +
labs(title="各样本密度曲线") + xlab("value")
          </textarea>
         </div>
         <div class="crayon-main" style="">
          <table class="crayon-table">
           <tbody>
            <tr class="crayon-row">
             <td class="crayon-nums " data-settings="show">
              <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
               <div class="crayon-num" data-line="crayon-57685340732c0754466455-1">
                1
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732c0754466455-2">
                2
               </div>
               <div class="crayon-num" data-line="crayon-57685340732c0754466455-3">
                3
               </div>
               <div class="crayon-num crayon-striped-num" data-line="crayon-57685340732c0754466455-4">
                4
               </div>
               <div class="crayon-num" data-line="crayon-57685340732c0754466455-5">
                5
               </div>
              </div>
             </td>
             <td class="crayon-code">
              <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
               <div class="crayon-line" id="crayon-57685340732c0754466455-1">
                <span class="crayon-p">
                 #分面
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732c0754466455-2">
                <span class="crayon-e">
                 qplot
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 value
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 data
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-v">
                 clt_data
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 geom
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "density"
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 color
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-v">
                 sizelevel
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 size
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-e">
                 I
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 1
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 facets
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-v">
                 sizelevel
                </span>
                <span class="crayon-o">
                 ~
                </span>
                <span class="crayon-sy">
                 .
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
                <span class="crayon-h">
                </span>
               </div>
               <div class="crayon-line" id="crayon-57685340732c0754466455-3">
                <span class="crayon-e">
                 geom_density
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-e">
                 aes
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 x
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-e">
                 rnorm
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 100
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-cn">
                 0
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-cn">
                 1
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 color
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "标准正态"
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 size
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-e">
                 I
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 0.8
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 ,
                </span>
                <span class="crayon-v">
                 alpha
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-e">
                 I
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-cn">
                 0.005
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
               </div>
               <div class="crayon-line crayon-striped-line" id="crayon-57685340732c0754466455-4">
                <span class="crayon-e">
                 labs
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-v">
                 title
                </span>
                <span class="crayon-o">
                 =
                </span>
                <span class="crayon-s">
                 "各样本密度曲线"
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-o">
                 +
                </span>
                <span class="crayon-h">
                </span>
                <span class="crayon-e">
                 xlab
                </span>
                <span class="crayon-sy">
                 (
                </span>
                <span class="crayon-s">
                 "value"
                </span>
                <span class="crayon-sy">
                 )
                </span>
                <span class="crayon-h">
                </span>
               </div>
               <div class="crayon-line" id="crayon-57685340732c0754466455-5">
               </div>
              </div>
             </td>
            </tr>
           </tbody>
          </table>
         </div>
        </div>
        <!-- [Format Time: 0.0090 seconds] -->
       </div>
       <p>
        <img src="http://dataunion.org/wp-content/uploads/2015/05/5cd713f74b21d5cb25933085ecd22b85_b1.jpg"/>
       </p>
       <p>
        从图上仍然可以看出，在不同样本量下，
        <img src="http://dataunion.org/%0A"/>
        和标准正态的密度曲线比较接近，且近似程度随样本量的增大而增大。
       </p>
       <h2>
        TIPS
       </h2>
       <ul>
        <li>
         你可以看到，我所用的不过是 ggplot2 中的 qplot 函数，即 quick plot。还远没有掌握 ggplot2 的精髓。
        </li>
        <li>
         我的样本量并不是很大，最多也就10000，觉得 R 跑的比较慢，所以从简了。
        </li>
        <li>
         更深入的学习，推荐两本书：
        </li>
       </ul>
       <ol>
        <li>
         <a class=" wrap external" href="http://item.jd.com/11228891.html" rel="nofollow noreferrer" target="_blank">
          《ggplot2:数据分与图形艺术
          <i class="icon-external">
          </i>
         </a>
         <a class=" wrap external" href="http://item.jd.com/11228891.html" rel="nofollow noreferrer" target="_blank">
          》
          <i class="icon-external">
          </i>
         </a>
         软件包的开发者亲写的教程，已有中文翻译版。
        </li>
        <li>
         <a class=" wrap external" href="http://item.jd.com/11224757.html" rel="nofollow noreferrer" target="_blank">
          《Machine Learning for Hackers》
          <i class="icon-external">
          </i>
         </a>
         所有的图都是由 ggplot2 画出来。
        </li>
       </ol>
       <p>
        作者： 张伟棋 原文链接：http://zhuanlan.zhihu.com/datascience/19792783
       </p>
      </div>
      <div>
       <strong>
        注：转载文章均来自于公开网络，仅供学习使用，不会用于任何商业用途，如果侵犯到原作者的权益，请您与我们联系删除或者授权事宜，联系邮箱：contact@dataunion.org。转载数盟网站文章请注明原文章作者，否则产生的任何版权纠纷与数盟无关。
       </strong>
      </div>
      <!--content_text-->
      <div class="fenxian">
       <!-- JiaThis Button BEGIN -->
       <div class="jiathis_style_32x32">
        <p class="jiathis_button_weixin">
        </p>
        <p class="jiathis_button_tsina">
        </p>
        <p class="jiathis_button_qzone">
        </p>
        <p class="jiathis_button_cqq">
        </p>
        <p class="jiathis_button_tumblr">
        </p>
        <a class="jiathis jiathis_txt jtico jtico_jiathis" href="http://www.jiathis.com/share" target="_blank">
        </a>
        <p class="jiathis_counter_style">
        </p>
       </div>
       <!-- JiaThis Button END -->
      </div>
     </article>
     <!--content-->
     <!--相关文章-->
     <div class="xianguan">
      <div class="xianguantitle">
       相关文章！
      </div>
      <ul class="pic">
       <li>
        <a href="http://dataunion.org/20444.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/08/640.webp-1-300x134.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/20444.html" rel="bookmark" title="可视化经典：10大最绝妙的科学视图，so wonderful">
         可视化经典：10大最绝妙的科学视图，so wonderful
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/20291.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/08/24019_副本-298x300.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/20291.html" rel="bookmark" title="非统计学专业的人该如何学习 R 语言？">
         非统计学专业的人该如何学习 R 语言？
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/20006.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/07/t01c6d11a042b2baa38.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/20006.html" rel="bookmark" title="21个数据可视化利器！">
         21个数据可视化利器！
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/19992.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/07/8_副本.png"/>
        </a>
        <a class="link" href="http://dataunion.org/19992.html" rel="bookmark" title="美丽的数据——数据可视化与信息可视化浅谈">
         美丽的数据——数据可视化与信息可视化浅谈
        </a>
       </li>
      </ul>
     </div>
     <!--相关文章-->
     <div class="comment" id="comments">
      <!-- You can start editing here. -->
      <!-- If comments are open, but there are no comments. -->
      <div class="title">
       期待你一针见血的评论，Come on！
      </div>
      <div id="respond">
       <p>
        不用想啦，马上
        <a href="http://dataunion.org/wp-login.php?redirect_to=http%3A%2F%2Fdataunion.org%2F16951.html">
         "登录"
        </a>
        发表自已的想法.
       </p>
      </div>
     </div>
     <!-- .nav-single -->
    </div>
    <!--Container End-->
    <aside id="sitebar">
     <div class="sitebar_list2">
      <div class="wptag">
       <span class="tagtitle">
        热门标签+
       </span>
       <div class="tagg">
        <ul class="menu" id="menu-%e5%8f%8b%e6%83%85%e9%93%be%e6%8e%a5">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1605" id="menu-item-1605">
          <a href="http://taidizh.com/">
           泰迪智慧
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20884" id="menu-item-20884">
          <a href="http://www.transwarp.cn/">
           星环科技
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3538" id="menu-item-3538">
          <a href="http://datall.org/">
           珈和遥感
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20888" id="menu-item-20888">
          <a href="http://www.chinahadoop.cn/">
           小象学院
          </a>
         </li>
        </ul>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <div class="textwidget">
       <div align="center">
        <a href="http://study.163.com/course/courseMain.htm?courseId=991022" target="_blank">
         <img src="http://dataunion.org/wp-content/uploads/2016/03/dv.jpg"/>
        </a>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       文章分类
      </h4>
      <div class="tagcloud">
       <a class="tag-link-44" href="http://dataunion.org/category/industry/demo" style="font-size: 10.204724409449pt;" title="4个话题">
        Demo展示
       </a>
       <a class="tag-link-31" href="http://dataunion.org/category/experts" style="font-size: 15.826771653543pt;" title="52个话题">
        专家团队
       </a>
       <a class="tag-link-870" href="http://dataunion.org/category/tech/ai" style="font-size: 19.795275590551pt;" title="273个话题">
        人工智能
       </a>
       <a class="tag-link-488" href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f" style="font-size: 8pt;" title="1个话题">
        加入数盟
       </a>
       <a class="tag-link-869" href="http://dataunion.org/category/tech/viz" style="font-size: 17.204724409449pt;" title="93个话题">
        可视化
       </a>
       <a class="tag-link-30" href="http://dataunion.org/category/partners" style="font-size: 10.645669291339pt;" title="5个话题">
        合作伙伴
       </a>
       <a class="tag-link-889" href="http://dataunion.org/category/parterc" style="font-size: 11.582677165354pt;" title="8个话题">
        合作会议
       </a>
       <a class="tag-link-104" href="http://dataunion.org/category/books" style="font-size: 12.96062992126pt;" title="15个话题">
        图书
       </a>
       <a class="tag-link-220" href="http://dataunion.org/category/tech/base" style="font-size: 19.850393700787pt;" title="281个话题">
        基础架构
       </a>
       <a class="tag-link-219" href="http://dataunion.org/category/tech/analysis" style="font-size: 19.409448818898pt;" title="232个话题">
        数据分析
       </a>
       <a class="tag-link-887" href="http://dataunion.org/category/tech/dm" style="font-size: 13.291338582677pt;" title="17个话题">
        数据挖掘
       </a>
       <a class="tag-link-34" href="http://dataunion.org/category/tech" style="font-size: 20.732283464567pt;" title="404个话题">
        文章
       </a>
       <a class="tag-link-1" href="http://dataunion.org/category/uncategorized" style="font-size: 22pt;" title="693个话题">
        未分类
       </a>
       <a class="tag-link-4" href="http://dataunion.org/category/events" style="font-size: 14.503937007874pt;" title="29个话题">
        活动
       </a>
       <a class="tag-link-890" href="http://dataunion.org/category/tech/%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0" style="font-size: 10.204724409449pt;" title="4个话题">
        深度学习
       </a>
       <a class="tag-link-221" href="http://dataunion.org/category/tech/devl" style="font-size: 18.968503937008pt;" title="193个话题">
        编程语言
       </a>
       <a class="tag-link-888" href="http://dataunion.org/category/career" style="font-size: 15.661417322835pt;" title="48个话题">
        职业规划
       </a>
       <a class="tag-link-5" href="http://dataunion.org/category/jobs" style="font-size: 14.11811023622pt;" title="25个话题">
        职位
       </a>
       <a class="tag-link-871" href="http://dataunion.org/category/industry" style="font-size: 15.716535433071pt;" title="49个话题">
        行业
       </a>
       <a class="tag-link-613" href="http://dataunion.org/category/industry/case" style="font-size: 16.984251968504pt;" title="84个话题">
        行业应用
       </a>
       <a class="tag-link-885" href="http://dataunion.org/category/industry/news" style="font-size: 17.425196850394pt;" title="102个话题">
        行业资讯
       </a>
       <a class="tag-link-10" href="http://dataunion.org/category/training" style="font-size: 14.228346456693pt;" title="26个话题">
        课程
       </a>
       <a class="tag-link-16" href="http://dataunion.org/category/sources" style="font-size: 15.661417322835pt;" title="48个话题">
        资源
       </a>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       功能
      </h4>
      <ul>
       <li>
        <a href="http://dataunion.org/wp-login.php?action=register">
         注册
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/wp-login.php">
         登录
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/feed">
         文章
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/comments/feed">
         评论
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="https://cn.wordpress.org/" title="基于WordPress，一个优美、先进的个人信息发布平台。">
         WordPress.org
        </a>
       </li>
      </ul>
     </div>
    </aside>
    <div class="clear">
    </div>
   </div>
   <!--main-->
   ﻿
   <footer id="dibu">
    <div class="about">
     <div class="right">
      <ul class="menu" id="menu-%e5%ba%95%e9%83%a8%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-18024" id="menu-item-18024">
        <a href="http://dataunion.org/category/partners">
         合作伙伴
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20881" id="menu-item-20881">
        <a href="http://dataunion.org/contribute">
         文章投稿
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20872" id="menu-item-20872">
        <a href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f">
         加入数盟
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22441" id="menu-item-22441">
        <a href="http://dataunion.org/f-links">
         友情链接
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20874" id="menu-item-20874">
        <a href="http://dataunion.org/aboutus">
         关于数盟
        </a>
       </li>
      </ul>
      <p class="banquan">
       数盟社区        ，
        做最棒的数据科学社区
      </p>
     </div>
     <div class="left">
      <ul class="bottomlist">
       <li>
        <a href="http://weibo.com/DataScientistUnion  " target="_blank" 　title="">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weibo.png"/>
        </a>
       </li>
       <li>
        <a class="cd-popup-trigger" href="http://dataunion.org/16951.html#0">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weixin.png"/>
        </a>
       </li>
      </ul>
      <div class="cd-popup">
       <div class="cd-popup-container">
        <h1>
         扫描二维码,加微信公众号
        </h1>
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/2014-12-06-1515289049.png"/>
        <a class="cd-popup-close" href="http://dataunion.org/16951.html">
        </a>
       </div>
       <!-- cd-popup-container -->
      </div>
      <!-- cd-popup -->
     </div>
    </div>
    <!--about-->
    <div class="bottom">
     <a href="http://dataunion.org/">
      数盟社区
     </a>
     <a href="http://www.miitbeian.gov.cn/" rel="external nofollow" target="_blank">
      京ICP备14026740号
     </a>
     联系我们：
     <a href="mailto:contact@dataunion.org" target="_blank">
      contact@dataunion.org
     </a>
     <div class="tongji">
     </div>
     <!--bottom-->
     <div class="scroll" id="scroll" style="display:none;">
      ︿
     </div>
    </div>
   </footer>
   <!--dibu-->
  </div>
 </body>
</html>